﻿using System.Web.Mvc;
using System;
using TNPTN.Services;
using TNPTN.Constant;
using TNPTN.Models;
using System.Data.SqlClient;
namespace TNPTN.Controllers
{
    /// <summary>
    /// Home controller
    /// Author: jayam - jabraok
    /// </summary>
    public class NHomeController : BaseController
    {
        #region Common
        private TDownloadService tDownloadService;

        /// <summary>
        /// Contructor
        /// </summary>
        /// <param name="tDownloadService">TDownloadService</param>
        public NHomeController(TDownloadService tDownloadService)
        {
            this.tDownloadService = tDownloadService;
        }
        #endregion

        #region Actions

        /// <summary>
        /// Index
        /// </summary>
        /// <returns>ActionResult</returns>
        public ActionResult Index()
        {
            //Get counting
            ViewBag.TotalDowload = this.tDownloadService.CountList();
            ViewBag.TotalVisitor = (int)this.Session[Common.SES_COUNT_VISITOR];

            //switch view for language
            string viewName = "Index";
            switch (TNPTN.Session.Info.LangID)
            {
                case Enums.LanguageID.English:
                    break;

                case Enums.LanguageID.Vietnamese:
                    viewName = "IndexVie";
                    break;

                default:
                    break;
            }

            return View(viewName);
        }

        /// <summary>
        /// Building
        /// </summary>
        /// <returns>ActionResult</returns>
        public ActionResult Building()
        {
            return View();
        }

        #endregion
    }
}
